package com.zhudi.model.enums;

import lombok.Data;

public enum TeamStatusEnum {
    //公开
    PUBLIC(0,"公开"),
    //私有
    PRIVATE(1,"私有"),
    //加密
    ENCRYPTION(2,"加密")
    ;

    private int status;
    private String test;

    public String getTest() {
        return test;
    }

    public void setTest(String test) {
        this.test = test;
    }

    TeamStatusEnum(int status, String test) {
        this.status = status;
        this.test = test;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    /**
     * 根据value找到对应的枚举类
     * @param value 状态
     * @return 对应的枚举类
     */
    public static TeamStatusEnum getSatus(int value){
        //遍历枚举类来找到value对应的那个枚举
        for (TeamStatusEnum teamStatusEnum : TeamStatusEnum.values()) {
            if (teamStatusEnum.getStatus()==value){
                return teamStatusEnum;
            }
        }
        //如果找不到则返回空
        return null;
    }
}
